#include "stdafx.h"
#include "ckFolder.h"
#include "ckEnumFolder.h"

namespace ck
{
	EnumFolder::EnumFolder()
	{
	}


	EnumFolder::~EnumFolder()
	{
		Cleanup();
	}

	void EnumFolder::Add(Folder* pCase)
	{
		if (pCase)
		{
			m_folders.push_back(pCase);
		}
	}

	void EnumFolder::Cleanup()
	{
		std::vector<Folder*>::iterator iter;
		for (iter = m_folders.begin(); iter != m_folders.end(); iter++)
		{
			(*iter)->Release();
		}
		m_folders.clear();
	}

	void EnumFolder::Reset()
	{
		m_iter = m_folders.begin();
	}

	Folder* EnumFolder::Next()
	{
		if (m_iter == m_folders.end())
		{
			return NULL;
		}
		return *(m_iter++);
	}
}

